home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_06
/
1106120a
< prev
next >
Wrap
Text File
|
1993-04-10
|
731b
|
50 lines
#include <iostream.h>
class XXX { ... };
int f()
{
int i;
// ...
if (... something wrong ...)
throw 2;
}
int g()
{
XXX x;
unsigned long ul;
// ...
if (... something else wrong ...)
throw x;
return f();
}
int h()
{
try
{
// ...
g();
// ...
return 0;
}
catch (int n)
{
cerr << "# " << n << " happened\n";
return n;
}
catch (char *s)
{
cerr << s << " went wrong\n";
return -1;
}
catch (const XXX &x)
{
cerr << x << " went wrong\n";
return -1;
}
}